﻿<div ng-controller="categoryController">
    <div class="wrapper border-bottom white-bg page-heading">
        <div class="col-lg-pull-12">
            <ol class="breadcrumb">
                <li><a ui-sref="app.goods.category">商品分类</a></li>
                <li class="active" ng-bind="breadcrumb"></li>
            </ol>
        </div>
    </div>
    <form name="_form" class="form-horizontal w5c-form" w5c-form-validate="model.validateOptions" novalidate role="form">
        <div class="form-group">
            <label class="col-sm-2 control-label">名称</label>
            <div class="col-sm-6">
                <input type="text" name="name" class="form-control input-sm" ng-model="model.name" required ng-minlength="1" ng-maxlength="25">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-2 control-label">说明</label>
            <div class="col-sm-10">
                <input type="text" name="remark" class="form-control input-sm" ng-model="model.remark">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-2 control-label">上级类型</label>
            <div class="col-sm-6">
                <ui-select ng-model="model.parent_id" theme="bootstrap">
                    <ui-select-match placeholder="选择上级类型">{{$select.selected.name}}</ui-select-match>
                    <ui-select-choices repeat="item.id as item in list | propsFilter: {name: $select.search}">
                        <div><span ng-if="item.parent_id!=0" style="padding-left:{{20*(item.depth-1)}}px;"></span> {{item.name}}</div>
                    </ui-select-choices>
                </ui-select>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-2 control-label">分类图</label>
            <div class="col-sm-5">
                <input type="file" name="file" accept="image/*" multiple="multiple" class="form-control input-sm" ngf-select ng-model="model.file">
                <input type="hidden" name="imgs" class="form-control" ng-model="model.image_urls" />
                <div ui-sortable ng-model="model.image_urls">
                    <div class="img-thumbnail pull-left" ng-repeat="img in model.image_urls" style="position:relative;margin-right:5px;">
                        <button type="button" class="close" ng-click="delete_image(img)" style="position:absolute;right:6px;">
                            <span aria-hidden="true">&times;</span>
                        </button>
                        <img ng-src="{{siteImg+img}}" class="img-thumbnail" ng-show="model.image_urls" width="80" height="37">
                    </div>
                </div>
                <div class="clearfix"></div>
                <p style="margin-top:10px;">
                    建议尺寸：第一分类比例640 x 296 像素；第二分类为正方型，您可以拖拽图片调整图片顺序。
                </p>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-2 control-label">是否显示</label>
            <div class="col-sm-6">
                <div class="checkbox">
                    <label>
                        <input type="checkbox" name="is_show" ng-checked="model.is_show" ng-model="model.is_show"> {{model.is_show?"显示":"隐藏"}}
                    </label>
                </div>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-2 control-label">排序</label>
            <div class="col-sm-6">
                <input type="number" name="sort" class="form-control input-sm" ng-model="model.sort">
            </div>
        </div>
        <div class="form-group">
            <div class="col-sm-offset-2 col-sm-10">
                <button type="submit" w5c-form-submit="save()" class="btn btn-primary btn-sm" btn-loading="psdisabled" loading-text="保存中..." ng-disabled="psdisabled">
                    <i class="fa fa-save"></i> 保存
                </button>
                <button ng-click="goBack()" class="btn btn-primary btn-sm"><i class="fa fa-rotate-left"></i> 取消</button>
            </div>
        </div>
    </form>
</div>